Apache proxy to Lighttpd: changing $_SERVER['HTTP_HOST'] in php

Posted by watain on Stack Overflow See other posts from Stack Overflow or by watain
Published on 2010-05-10T07:01:34Z Indexed on 2010/05/10 7:04 UTC
Read the original article Hit count: 285

Filed under:
|
|
|
|

I have a WordPress blog running on lighttpd-1.4.19, listening on at www00:81. On the same host, apache-2.2.11 listens on port 80, which creates a proxy connection from http://blog.mydomain.org:80 to http://blog.mydomain.org:81. The Apache virtualhost looks as follows:

<VirtualHost *:80>
    ServerName blog.mydomain.org
    ProxyRequests Off

    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>

    ProxyPass / http://blog.mydomain.org:81/
    ProxyPassReverse / http://blog.mydomain.org:81/
</VirtualHost>

Using debug.log-request-handling = "enable" I get the following log entry when I browse http://blog.mydomain.org:80 (notice the Host headers):

2010-05-10 08:47:14: (request.c.294) fd: 6 request-len: 853 
GET / HTTP/1.1
Host: blog.mydomain.org:81
[...]

2010-05-10 08:47:15: (request.c.294) fd: 8 request-len: 754 
GET /wp-content/uploads/2010/01/image.gif?w=280 HTTP/1.1
Host: www00:81

My problem: as far as I know, the PHP environment variable $_SERVER['HTTP_HOST'] is set to that Host header variable. Unfortunately, WordPress uses that variable in their system to create URLs to pictures on the blog. These URLs won't be accessible behind a firewall of course. How can I force the host header to be blog.mydomain.org instead of blog.mydomain.org:81, respectively www00:81? I already added set server.name = "blog.mydomain.org" to my lighttpd.conf, but this didn't work.

Any suggestions are appreciated, thank you.

© Stack Overflow or respective owner

Related posts about apache

Related posts about lighttpd